Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Programmer's Overview / Part 1 - Getting Started With QuickDraw GX
Chapter 2 - A Quick & Easy Sample Program


Examining the Curve Shape With GraphicsBug

The example described in this chapter is simple enough that you might
not have any bugs when you recreate it. However, as your QuickDraw GX programming tasks grow larger, you will almost certainly run into a bug
or two.

To help you track down those bugs, QuickDraw GX provides the GraphicsBug application, which you use in conjunction with MacsBug (or the high-level debugger of your choice).

GraphicsBug is an application. When you launch it, the GraphicsBug command window appears as an empty, untitled window.

Imagine that you've set a breakpoint in your sample program on the line of code that calls the GXDrawShape function. When you execute your program, it breaks on this line and sends you into your debugger. You should use your debugger to determine the value of your aCurveShape variable--this value is the object reference value for your curve shape object.

Once you've determined the value of this variable (for example, 00EBEAF8), you can switch into the GraphicsBug application.

Once in GraphicsBug, you need to inform GraphicsBug that you want to examine objects in your application's graphics client heap. In the Heap menu
of GraphicsBug, you'll find a list of all current graphics heaps, including the one for your application. When you select the one for your application, GraphicsBug responds with this message in the command window:

Heap set to 00eb88d0  "QuickEasyCurve.º"
Now you're ready to use GraphicsBug to examine the contents of your curve shape. The commands of GraphicsBug are similar to those of MacsBug. You can get a list of commands by typing a question mark.

To examine the contents of your curve shape, you can use your high-level debugger to determine the value of your aCurveShape variable and then use the lower part of the command window to type in this GraphicsBug command:

dm 0x00ebeaf8 t
In this command, the dm means you want to display memory, the 00EBEAF8 is the reference to the memory you want to display, and the t means that you want GraphicsBug to display the memory formatted as the correct object type.

Note
You can also request a list of memory references to all
the curves in your graphics client heap by entering the command hd curve. You can then examine the
contents of any of the curves by option-double-clicking
on the corresponding reference displayed in the
command window.
Figure 2-7 shows this command typed in the command-line part of the window.

Figure 2-7 Typing a command to GraphicsBug

Figure 2-8 shows how GraphicsBug responds when you enter the command by pressing the Return or Enter key.

Figure 2-8 Displaying the properties of a shape object

As you can see, GraphicsBug responds to the dm command by displaying the values of your curve shape's properties. It also displays the values of some properties used internally by QuickDraw GX, such as devShape and seed.

From this example, you can discover that

You can use the reference values for your curve shape's style, ink, and transform objects to examine their properties. For example, the reference value for the curve's ink object is 00eb9640. Therefore, you can type the command

dm 00eb9640 t

and when you press the Enter or the Return key, GraphicsBug responds as in Figure 2-9. (Alternatively, you can option-double-click on this object reference value where it is displayed in the command window.)

Figure 2-9 Displaying the properties of a supporting object

Among other information in this example, you can find out that

You can similarly examine the values of the properties of the style and transform objects associated with your curve shape.

Well, that's the end of the Quick & Easy sample program! In the next chapter, you'll find a more thorough discussion of the concepts introduced here and
in Part Two of this book, you'll find a number of extensive programming examples.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996